package Exception;

import java.io.FileOutputStream;

public class Finally2Demo {
    public static void main(String[] args) {
        FileOutputStream fos=null;
        try{
            fos=new FileOutputStream("fos.txt");
            fos.write(97);

        }catch(Exception e){
            System.out.println("出错了");
        }finally {
            try{
                if(fos!=null){
                    fos.close();
                    System.out.println("关闭成功");
                }
            }catch(Exception e){
                System.out.println("关闭出错");
            }
        }
    }

}
